import axios from 'axios'

const ERR_OK = 0
const BASE_URL = process.env.NODE_ENV === 'production' ? 'http://ustbhuangyi.com/music-next/' : '/'
axios.defaults.baseURL = BASE_URL
export const get = (url, params) => {
  return new Promise((resolve, reject) => {
    axios.get(url, {
      params
    }).then(res => {
      if (res.data.code === ERR_OK) {
        resolve(res.data.result)
      } else {
        reject(res)
      }
    })
  })
}
